package Practice.Practice_02.FingerGuessingGame;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Login login = new Login();
        Play play = new Play();
        Scanner sc = new Scanner(System.in);
        System.out.print("请输入账号：");
        String user = sc.next();
        System.out.print("请输入密码：");
        String password = sc.next();
        boolean flag = login.log(user, password);
        if (flag) {
            System.out.println("欢迎登录");
        }else{
            System.out.println("输入的账号或密码错误！");
            System.exit(2);
        }
        for(int i = 1; i <= 5; i++) {
            System.out.println("1是剪刀，2是石头，3是布");
            System.out.print("请选择：");
            int x = sc.nextInt();
            if(x<1||x>3){
                System.out.println("输入有误！");
                i--;
                continue;
            }
            int y = (int)(Math.random()*3+1);
            play.result(x,y);
            System.out.println("您还要继续吗？0-退出");
            int t = sc.nextInt();
            if(t==0){
                break;
            }
        }
        int s = play.getS();
        int f = play.getF();
        int p = play.getP();
        System.out.println("游戏结束，总共：" + s + "胜，" + f + "负，" + p + "平");
    }
}
